package com.jc.platform.coursemanage.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jc.platform.common.supers.AbstractEntity;
import com.jc.platform.coursemanage.vo.CourseVO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.Date;
import java.math.*;

/**
 * ClassName CourseEntity.java
 * Description 
 *
 * @author Wen
 * @version 7.0
 * @date 2021/09/28
 */
@Data
@TableName("course")
@EqualsAndHashCode(of = { "id" }, callSuper = false)
public class CourseEntity extends AbstractEntity<CourseVO> implements Serializable
{
	private static final long serialVersionUID = 1L;

     @TableField(value = ("id"))
     private Long id;
     @TableField(value = ("course_name"))
     private String courseName;
     @TableField(value = ("major_id"))
     private Long majorId;
     @TableField(value = ("instructor_id"))
     private Long instructorId;
     @TableField(value = ("description"), updateStrategy = FieldStrategy.IGNORED )
     private String description;
     @TableField(value = ("credit"))
     private Integer credit;
     @TableField(value = ("start_date"))
     private Date startDate;
     @TableField(value = ("end_date"))
     private Date endDate;
     @TableField(value = ("final_date"), updateStrategy = FieldStrategy.IGNORED )
     private Date finalDate;
     @TableField(value = ("create_id"))
     private Long createId;
     @TableField(value = ("create_name"))
     private String createName;
     @TableField(value = ("create_time"))
     private Date createTime;
     @TableField(value = ("modify_id"))
     private Long modifyId;
     @TableField(value = ("modify_name"))
     private String modifyName;
     @TableField(value = ("modify_time"))
     private Date modifyTime;
     @TableField(value = ("extension"))
     private String extension;
     @TableField(value = ("tenant_id"))
     private Long tenantId;
     @TableField(value = ("group_id"))
     private Long groupId;
     @TableField(value = ("org_id"))
     private Long orgId;
     @TableField(value = ("dept_id"))
     private Long deptId;

	/**
	 * 生成vo对象
	 *
	 * @return vo对象
	 */
	public CourseVO copyToVO()
	{
        Long defaultDate = -28800000L;

		CourseVO vo = new CourseVO();
        vo.setId(this.id);
        vo.setCourseName(this.courseName);
        vo.setMajorId(this.majorId);
        vo.setInstructorId(this.instructorId);
        vo.setDescription(this.description);
        vo.setCredit(this.credit);
        vo.setStartDate(this.startDate);
        vo.setEndDate(this.endDate);
        vo.setFinalDate(this.finalDate);
        vo.setCreateId(this.createId);
        vo.setCreateName(this.createName);
        vo.setCreateTime(this.createTime);
        vo.setModifyId(this.modifyId);
        vo.setModifyName(this.modifyName);
        vo.setModifyTime(this.modifyTime);
        vo.setExtension(this.extension);
        vo.setTenantId(this.tenantId);
        vo.setGroupId(this.groupId);
        vo.setOrgId(this.orgId);
        vo.setDeptId(this.deptId);
		return vo;
	}

	/**
	 * 从vo对象更新属性
	 *
	 * @param vo vo对象
	 */
	public void copyFormVO(CourseVO vo)
	{
        this.setId(vo.getId());
        this.setCourseName(vo.getCourseName());
        this.setMajorId(vo.getMajorId());
        this.setInstructorId(vo.getInstructorId());
        this.setDescription(vo.getDescription());
        this.setCredit(vo.getCredit());
        this.setStartDate(vo.getStartDate());
        this.setEndDate(vo.getEndDate());
        this.setFinalDate(vo.getFinalDate());
        this.setCreateId(vo.getCreateId());
        this.setCreateName(vo.getCreateName());
        this.setCreateTime(vo.getCreateTime());
        this.setModifyId(vo.getModifyId());
        this.setModifyName(vo.getModifyName());
        this.setModifyTime(vo.getModifyTime());
        this.setExtension(vo.getExtension());
        this.setTenantId(vo.getTenantId());
        this.setGroupId(vo.getGroupId());
        this.setOrgId(vo.getOrgId());
        this.setDeptId(vo.getDeptId());
	}
}
